﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace t14commomclass
{
    class Program
    {
        static void Main(string[] args)
        {
            #region Math类
            Console.WriteLine(Math.E);
            Console.WriteLine(Math.PI);
            Console.WriteLine(Math.Abs(-10));
            Console.WriteLine(Math.Floor(20.1));
            Console.WriteLine(Math.Round (20.5));
            Console.WriteLine(Math.Sqrt(16));

            #endregion

            #region stringbuilder类
            StringBuilder sb = new StringBuilder();
            Console.WriteLine(sb.Capacity );
            Console.WriteLine(sb.MaxCapacity);
            Console.WriteLine(sb.Length ); ;
            string str = "是";
            sb.Append("我");
            sb.Append(str);
            sb.Append("中国人");
            Console.WriteLine(sb .ToString ());
            #endregion

            #region  DateTime类
            Console.WriteLine(DateTime.Now);
            Console.WriteLine(DateTime.Today);
            Console.WriteLine(DateTime.Parse("2018/10/30"));
            Console.WriteLine(DateTime.Now.AddDays (-1).ToShortDateString() );
            Console.WriteLine(DateTime.Now.DayOfWeek);
            string[] day = new string[] {
                "星期天","星期一","星期二","星期三","星期四","星期五","星期六"
                };
            Console.WriteLine(day[Convert.ToInt32(DateTime.Now.DayOfWeek)]);
            Console.WriteLine(DateTime .Now.ToString ("yyyy年MM月DD日"));

            Console.WriteLine("请输入日期");
            DateTime dt = DateTime.Parse(Console.ReadLine());
            string strWeek = "天一二三四五六".Substring(Convert.ToInt32(dt.DayOfWeek), 1);
            Console.WriteLine("今天是{0}年{1}月{2}日，是一年中的第{4}天",dt.Year,dt.Month,dt.Day,strWeek,dt.DayOfYear);
            #endregion
            Console.ReadKey ();
        }
    }
}
